//@author A0096759E

package storage;

import applogger.AppLogger;


public class SavedEventsList {
	private ScheduleEvent[] savedEventsList;

	/**
	 * Sets the savedEventsList field as the Parameter 
	 * @param savedEventsList
	 */
	public void setSavedEventsList(ScheduleEvent[] savedEventsList) {
		this.savedEventsList = savedEventsList;		
	}
	
	/**
	 * Returns the ScheduleEvent at that index.
	 * @param index
	 * @return ScheduleEvent at index
	 */
	public ScheduleEvent get(int index) {
		try {
			return savedEventsList[index];
		} catch (NullPointerException e) {
			AppLogger.log(e.toString());
			return null;
		}
	}
	
	/**
	 * Returns the size of the savedEventsList 
	 * @return savedEventsList.length
	 */
	public int getSize() {
		if (savedEventsList != null) {
			return this.savedEventsList.length;
		} else {
			AppLogger.log("savedEventsList is null!");
			return -1;
		}
	}
}
